stateful vs stateless explained by example